package br.com.fidalgotecnologia.layar.json;

import org.json.JSONException;
import org.json.JSONObject;

import br.com.fidalgotecnologia.layar.entity.Anchor;
import br.com.fidalgotecnologia.layar.entity.Geolocation;

public class GeolocationJson {
	private Geolocation geolocation;
    private JSONObject json;
    
    public GeolocationJson(Geolocation geolocation){
    	this.geolocation =geolocation;
    	json = new JSONObject();
    	try {
			
				json.put("lat", this.geolocation.getLat());
				json.put("lon", this.geolocation.getLon());
			
			
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
    
   public JSONObject getJson() {
	return json;
}
    
	@Override
	public String toString() {
		String retorno = null;
		
		try {
			
			retorno = json.toString();
		} catch (Exception  e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return retorno;
	}
}
